package pro.softzhang.algo.lc700;

/**
 * 没思路呀
 */
public class LC769_MaxChunksToMakeSorted {
    public static void main(String[] args) {

    }

    static class Solution {
        public int maxChunksToSorted(int[] arr) {
            int m = 0, n = 0;
            for (int i = 0; i < arr.length; i++) {
                m = Math.max(m, arr[i]);
                if (m == i) {
                    n++;
                }
            }
            return n;
        }
    }
}
